<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue'
export default {
  data () {
    return {
      cdata: {
        category: [
          "0:00-1:00",
          "1:00-2:00",
          "2:00-3:00",
          "3:00-4:00",
          "4:00-5:00",
          "5:00-6:00",
          "6:00-7:00",
          "7:00-8:00",
          "8:00-9:00",
          "9:00-10:00",
          "10:00-11:00",
          "11:00-12:00",
          "12:00-13:00",
          "13:00-14:00",
          "14:00-15:00",
          "15:00-16:00",
          "16:00-17:00",
          "17:00-18:00",
          "18:00-19:00",
          "19:00-20:00",
          "20:00-21:00",
          "21:00-22:00",
          "22:00-23:00",
          "23:00-24:00"
        ],
        lineData: [
          2809,
          3072,
          3404,
          3838,
          3208,
          3097,
          3867,
          3471,
          3844,
          3041,
          3606,
          3267,
          3952,
          3756,
          3700,
          3500,
          3000,
          3500,
          3288,
          3609,
          3986,
          3471,
          3844,
          3041,
          3609,
          3986,
          3471,
          3844,
          3041,
          3001,
          3267,
          3952,
          3280
        ],
        barData: [
          1610,
          1700,
          1750,
          1750,
          1750,
          1740,
          2390,
          2350,
          1900,
          2150,
          2320,
          2445,
          2525,
          3330,
          2800,
          3200,
          2730,
          2600,
          2800,
          2800,
          1290,
          1480,
          1586,
          1506,
          1451
        ],
        rateData: []
      }
    };
  },
  components: {
    Chart,
  },
  mounted () {
    this.setData();
  },
  methods: {
    // 根据自己的业务情况修改
    setData () {
      for (let i = 0; i < this.cdata.barData.length -1; i++) {
        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
    },
  }
};
</script>

<style lang="scss" scoped>
</style>
